<%--
  Created by IntelliJ IDEA.
  User: lichengming
  Date: 2017/8/3
  Time: 上午7:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/resources.jsp" %>
<html>
<head>
    <title>企管培训订单</title>
    <script>
        $(function () {
            $('#begin_time,#end_time').datetimepicker({
                language : 'zh-CN',
                format : 'yyyy-MM-dd HH:mm:ss',
            });
        })
    </script>
</head>
<body>
<div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">查询条件</h3>
        </div>
        <div class="panel-body">
            <form class="form-inline ems_search_form">
                <div class="form-group">
                    <input type="text" class="form-control" id="nickName" name="nickName" placeholder="用户昵称">
                </div>
                <div class="form-group">
                    <input type="text" class="form-control" id="begin_time" name="begin_time" placeholder="起始创建时间">
                    <label>-</label>
                    <input type="text" class="form-control" id="end_time"  name="end_time" placeholder="截止创建时间">
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-info btn-search">查询</button>
                    <button type="button" class="btn btn-default btn-reset">清空</button>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="ems_table_content">
    <div class="panel panel-default">
        <div class="panel-heading">企管培训订单列表</div>
        <div id="table_tools">
            <div class="form-inline" role="form">
            </div>
        </div>
        <table id="merchantTable"
               data-url="/ems/trainorder/pagination">
            <thead>
            <tr>
                <th data-field="state" data-checkbox="true"></th>
                <th data-field="nick_name" >用户昵称</th>
                <th data-field="phone">手机号</th>
                <th data-field="title">课程名称</th>
                <th data-field="create_time">申请时间</th>
                <th data-field="status_" data-formatter="statusFormat">状态</th>
            </tr>
            </thead>
        </table>
    </div>
    <script>

        function statusFormat(srcValue) {

            if (srcValue == "1") {
                return "<span style='color: #3cb371;font-weight: bold' >已付款</span>";
            }else {
                return "<span style='color: red;font-weight: bold'>未付款</span>";
            }
        }
    </script>
</div>
<script>
    $(function () {

        $("#merchantTable").createTable();

        //编辑
//        $("#merchant_audit").on("click",function () {
//            var selectRows =  $('#merchantTable').bootstrapTable('getSelections');
//            if (selectRows.length == 0) {
//                $.errorAlert("请选择要审核的数据");
//                return;
//            }
//            if (selectRows.length > 1) {
//                $.errorAlert("暂时不支持多行数据审核");
//                return;
//            }
//
//            var selectRow = selectRows[0];
//            if(selectRow.status_ != 'auditing'){
//                $.errorAlert("只能审核待审核记录");
//                return;
//            }
//            window.location.href = "/ems/tradeorder/audit?id=" + selectRow.id_;
//        })


        //删除
//        $("#merchant_delete").on("click",function () {
//            var selectRows =  $('#merchantTable').bootstrapTable('getSelections');
//            if (selectRows.length == 0) {
//                $.errorAlert("请选择要删除的数据");
//                return;
//            }
//
//            var merchantIdList = "";
//            for (var i = 0;i<selectRows.length;i++) {
//                merchantIdList += selectRows[i].id + ",";
//            }
//            merchantIdList = merchantIdList.substring(0,merchantIdList.length - 1);
//            $.emsAjax({
//                data:{merchantIdList:merchantIdList},
//                type:"POST",
//                url:"/ems/tradeorder/delete",
//                success:function(resp) {
//                    if (resp.status == "000") {
//                        $.alert(resp.message);
//                        search("#merchantTable",getQueryParams());
//                    }else {
//                        $.errorAlert(resp.message);
//                    }
//                }
//            });
//        });
    });

    function tip(){
        $.errorAlert("只能审核待审核记录");
    }
</script>
</body>
</html>
